<?php


namespace App\Services;


use App\Job\OrderFinishJob;
use App\Job\OrderPayJob;
use App\Job\OrderRefundJob;
use Illuminate\Support\Facades\Log;

class QueueOrderService
{
    public function OrderPay($order_no, $user_id, $referer_id, $amount, $bonus, $mt, $status, $created_at, $updated_at)
    {
        $mt = 100 * (int)($mt / 100);
        Log::info('OrderPayJob',[$order_no, $user_id, $referer_id, $amount, $bonus, $mt, $status, $created_at, $updated_at]);
        return app(QueueService::class)->produce(new OrderPayJob($order_no, $user_id, $referer_id, $amount, $bonus, $mt, $status, $created_at, $updated_at), $delay = 0);
    }



    public function OrderFinish($order_no, $status)
    {
        Log::info('OrderFinishJob',[$order_no,$status]);
        return app(QueueService::class)->produce(new OrderFinishJob($order_no, $status), $delay = 0);
    }


    public function OrderRefund($order_no, $status)
    {
        Log::info('OrderRefundJob',[$order_no,$status]);
        return app(QueueService::class)->produce(new OrderRefundJob($order_no, $status), $delay = 0);
    }





}
